#include "../../include/arm/assembler.h"
#include "../../include/arm/v7m.h"

/*
 * Register switch for ARMv7-M processors.
 * r0 = previous task_struct, r1 = previous thread_info,
 * r2 = next task_struct, r3 = next thread_info
 * previous and next are guaranteed not to be the same.
 */
ENTRY(__switch_to)
    push {r4, r5}

	ldr	r4, =BASEADDR_V7M_SCB
	mov	r5, #V7M_SCB_ICSR_PENDSVSET
	str	r5, [r4, V7M_SCB_ICSR]

	pop {r4, r5}

    bx lr
ENDPROC(__switch_to)
